<?php

// $Id$

require_once(TANGRA_MAIN_DIR.'form/guardable_form.class.php');
require_once(TANGRA_MAIN_DIR.'form/fields/text/form_field_text.class.php');
require_once(TANGRA_MAIN_DIR.'form/fields/integer_positive/form_field_integer_positive.class.php');
require_once(TANGRA_MAIN_DIR.'form/fields/checkbox/form_field_checkbox.class.php');
require_once(TANGRA_MAIN_DIR.'form/fields/radio_group/form_field_radio_group.class.php');
require_once(TANGRA_MAIN_DIR.'/form/static_html_form_generator.class.php');


class Menu_Item_Form extends Guardable_Form {
	function __construct() {
		parent::__construct('menu_item', 'admin/modules/tangra_cms/menu/menu_item_edit.php');

		$f_label = new Form_Field_Text('label', true, 255);
		$this->add_field($f_label);

		$f_ordering = new Form_Field_Integer_Positive('ordering', true, false, 10);
		$this->add_field($f_ordering);

		$f_nofollow = new Form_Field_Checkbox('nofollow', false);
		$this->add_field($f_nofollow);

		$f_new_window = new Form_Field_Radio_Group('new_window', 0, true);
		$f_new_window->add_radio(0);
		$f_new_window->add_radio(1);
		$f_new_window->add_radio(2);
		$this->add_field($f_new_window);

		$f_additional = new Form_Field_Text('additional', false, 255);
		$this->add_field($f_additional);
	}


	public function generate_html() {
		$html_gen = new Static_HTML_Form_Generator($this, 'modules/form_html_tpl_static_ajax_metallic_en', 'en');
		$html_gen->create_default_tpl_maps();

		printbr('<pre>');
		printbr(htmlentities($html_gen->get_static_html()));
		printbr('</pre>');
	}
}
